<extend name="Base/common"/>
<block name="body">
	<div class="span9 page_message">
		<section id="contents">
			<ul class="tab-nav nav">
				<li class=""><a href="{:U('lists')}">邀约列表<b class="arrow fa fa-sort"></b></a></li>
				<li class="current"><a href="javascript:;">新增邀约活动<b class="arrow fa fa-sort"></b></a></li>
			</ul>
			<div class="tab-content">
				<!-- 表单 -->
				<php> $post_url || $post_url = U('edit?model='.$model['id'], $get_param);</php>
				<form id="form" action="{$post_url}" method="post" class="form-horizontal form-center">
					<ul id="tab" class="tab-pane in">
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>关键词<span
									class="check-tips"></span></label>

							<div class="controls">
								<input type="text" class="text input-large" name="keyword" value="{$data.keyword}">
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>标题<span class="check-tips"></span></label>

							<div class="controls">
								<input type="text" class="text input-large" name="title" value="{$data.title}">
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>封面简介<span
									class="check-tips"></span></label>

							<div class="controls">
								<label class="textarea input-large">
									<textarea class="text input-large" name="intro">{$data.intro}</textarea>
								</label>
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>封面图片<span
									class="check-tips"></span></label>

							<div class="controls uploadrow2" title="点击修改图片" rel="cover">
								<input type="file" id="upload_picture_cover">
								<input type="hidden" name="cover" id="cover_id_cover" value="{$data.cover}"/>

								<div class="upload-img-box">
									<notempty name="data[cover]">
										<div class="upload-pre-item2"><img width="100" height="100"
										                                   src="{$data.cover|get_cover_url}"/></div>
										<em class="edit_img_icon">&nbsp;</em>
									</notempty>
								</div>
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>消耗经历值<span class="check-tips">（默认为0）</span></label>

							<div class="controls">
								<label class="textarea input-large">
									<input type="number" class="text input-large" name="experience"
									       value="{$data.experience}"/>
								</label>
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>邀约人数<span class="check-tips">（邀约多少人才可以做某事）</span></label>

							<div class="controls">
								<label class="textarea input-large">
									<input type="number" class="text input-large" name="num" value="{$data.num}"/>
								</label>
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>优惠券ID<span class="check-tips">（优惠券列表中可找到）</span></label>

							<div class="controls">
								<label class="textarea input-large">
									<input type="number" class="text input-large" name="coupon_id"
									       value="{$data.coupon_id}"/>
								</label>
							</div>
						</li>
						<li class="form-item cf">
							<label class="item-label"><span class="need_flag">*</span>邀约详细介绍<span
									class="check-tips"></span></label>

							<div class="controls">
								<label class="textarea">
									<textarea name="content"
									          style="width:405px; height:100px;">{$data.content}</textarea>
									{:hook('adminArticleEdit', array('name'=>content,'value'=>''))} </label>
							</div>
						</li>


					</ul>
					<div class="form-item form_bh">
						<notempty name="data.id"><input type="hidden" name="id" value="{$data.id}"></notempty>
						<button class="btn submit-btn ajax-post" id="submit" type="submit"
						        target-form="form-horizontal">确 定
						</button>
					</div>
				</form>
			</div>
		</section>
	</div>
</block>
<block name="script">
	<link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
	<php>if(C('COLOR_STYLE')=='blue_color') echo '
		<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet"
		      type="text/css">
		';
	</php>
	<link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript"
	        src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}"
	        charset="UTF-8"></script>
	<script type="text/javascript">
		$(function () {
			initUploadImg();
		})
		$('#submit').click(function () {
			$('#form').submit();
		});

		$(function () {
			$('.time').datetimepicker({
				format: 'yyyy-mm-dd hh:ii',
				language: "zh-CN",
				minView: 0,
				autoclose: true
			});
			$('.date').datetimepicker({
				format: 'yyyy-mm-dd',
				language: "zh-CN",
				minView: 2,
				autoclose: true
			});
			showTab();

			$('.toggle-data').each(function () {
				var data = $(this).attr('toggle-data');
				if (data == '') return true;

				if ($(this).is(":selected") || $(this).is(":checked")) {
					change_event(this)
				}
			});

			$('.toggle-data').bind("click", function () {
				change_event(this)
			});
		});
	</script>
</block>
